<template>
  <div class="home height">
    <el-container class="height">
      <el-header>
        <div class="headerdiv1">
              <el-row >
                <el-col :span="8">
                  <div id="head-portrait">
                    <img width="100%" src="../assets/logo.png">
                  </div>
                </el-col>
                <el-col :span="8">
                  您好
                </el-col>
                <el-col :span="8" style="color:slateblue;">
                <el-popover
                style="height: 100%;"
                  placement="bottom"
                  width="400"
                  trigger="hover">
                <el-row class="rowhover"><el-button @click="window.localStorage.clear();$router.push('/')" style="width:100%;" type="text" >退出系统</el-button></el-row>
                  <p style="margin: 0;" slot="reference">{{empinfo.userName}}</p>
                </el-popover>
                </el-col>
              </el-row>
        </div>
      </el-header>
      <el-container>
        <el-aside width="collapse">
          <el-menu
            default-active="/user"
            class="el-menu-vertical-demo"
            open="handleOpen"
            close="handleClose"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#fff"
            :collapse="isCollapse"
            router
          >
            <el-menu-item @click="menu"
              ><i style="font-size: 25px" :class="menuicon"></i>
              <span>收起</span></el-menu-item>
              <el-menu-item index="/user">
              <i class="el-icon-setting"></i>
              <span slot="title">用户管理</span>
            </el-menu-item>
            <el-menu-item index="/recharge">
              <i class="el-icon-menu"></i>
              <span slot="title">交易记录</span>
            </el-menu-item>
            <el-menu-item index="/image_upload">
              <i class="el-icon-menu"></i>
              <span slot="title">轮播图</span>
            </el-menu-item>
            <el-menu-item index="/video_upload">
              <i class="el-icon-menu"></i>
              <span slot="title">视频</span>
            </el-menu-item>
            <!-- 添加 el-submenu 来创建号码统计的子菜单 -->
            <el-submenu index="">
              <template slot="title">号码统计</template>
              <el-menu-item index="/statis_pls">
                <span>排列三</span>
              </el-menu-item>
              <el-menu-item index="/statis_3d">
                <span>3D</span>
              </el-menu-item>
            </el-submenu>
            </el-menu>
        </el-aside>

        <el-main
          ><el-card class="box-card"><router-view></router-view></el-card
        ></el-main>
      </el-container>
    </el-container>
  </div>

</template>
<script>
import listmenu from '../components/Listmenu.vue'
export default {
  name: 'HomeView',
  components:{
    listmenu
  },
  data () {
    return {
      window: window,
      empinfo: {userName:''},
      menulist:[],
      list: [
        {
          name: 'aa',
          ch: [{
            name: 'ab'
          }]
        },
        {
          name: 'ba',
          ch: [{
            name: 'bb'
          }]
        }
      ],
      menuicon: 'el-icon-s-fold',
      isCollapse: false
    }
  },
  mounted () {
    // this.getempinfo()
    this.empinfo = JSON.parse(window.localStorage.getItem('userInfo'))

  },
  methods: {

    menu () {
      if (this.menuicon === 'el-icon-s-fold') {
        this.menuicon = 'el-icon-s-unfold'
      } else {
        this.menuicon = 'el-icon-s-fold'
      }
      this.isCollapse = !this.isCollapse
    },
    getempinfo () {
      this.$axios.get('bgs_crm/emp/getempinfo').then(res => {
        const data = res.data

        this.empinfo = data
      })
    },
    handleOpen (key, keyPath) {
      alert(1)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    }
  }
}
</script >
<style >

.height {
  height: 100%;
}
.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
}
.el-aside {
  background-color: #545c64;
  color: #333;
  text-align: center;
  line-height: 200px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  height: 100%;
}
.el-main {
  background-color: #e9eef3;
  color: #333;
  /* text-align: center; */
  /* line-height: 160px; */
}
body > .el-container {
  margin-bottom: 40px;
}
.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}
.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
.headerdiv1{
  height: 100%;
  width: 200px;

  float:right;
  margin-right: 50px;
}
  #head-portrait{
    width:60px;
    height:60px;
    border-radius: 50%;
    margin:0 auto;
    overflow: hidden;
    margin-bottom: 25px;
  }
  .el-popover{
    background-color: #B3C0D1 !important;
text-align: center !important;
width: 200px !important;
padding: 0 !important;
  }
  .el-button--text{
color: rgb(30, 28, 28) !important;

  }
   .rowhover{
    transition-duration: 0.5s;

   }
  .rowhover:hover{
    background-color: #7f8996;
  }

</style>
